<script src="./includes/common.js" type="text/javascript"></script>
<script src="./includes/jquery-1.7.min.js" type="text/javascript"></script>
<style>
div{
	vertical-align: middle;
}
.show_post {
	padding:40px;
}
.show_post p {
	padding:5px;
}
.show_post p select {
	border-color: #7F9DB9;
	border-style: solid;
	border-width: 1px;
	padding: 2px;
}
.left_post {
	width:100px;
	display:block;
	float:left;
	text-align:right;
	padding-right:20px;
}
.required {
	color: #FF0000;
	display: inline-block;
	font-size: 17px;
	padding-right:5px;
	vertical-align: middle;
}
.text1 {
	border: 1px solid #7F9DB9;
	height: 17px;
	margin-right: 4px;
	padding: 3px 2px 0;
	vertical-align: middle;
	width: 330px;
}
.text2{
	width: 170px !important;
}

.fabu1 {
    background: url("images/psearch.gif") no-repeat scroll 0 -100px transparent;
    border: medium none;
    color: #FFFFFF;
    cursor: pointer;
    font: 700 14px/34px "宋体",sans-serif;
    height: 34px;
    margin-right: 3px;
    overflow: hidden;
    text-align: center;
    width: 107px;
	margin-left:120px;
}
.fabu1:hover{
	padding-left:5px;
}

</style>
<?php
	
	//准备装载数据
	require_once("./includes/configure.php");
	require_once("./includes/database.php");
	$db = Database::Connect();
	$zufang_quyu_array = $db->getConfigurationArray('zufang_quyu');
	$zufang_zujin_array = $db->getConfigurationArray('zufang_zujin');
	$zufang_fangxing_array = $db->getConfigurationArray('zufang_fangxing');
	
	if($_POST['submit']){
		$biaoti = $_POST['title'];
		$quyu = $_POST['quyu'];
		$quyu2=$_POST['quyu2'];
		$zujin_goujia=$_POST['zujin_goujia'];
		$fangxing=$_POST['fangxing'];
		$xiangximiaoshu1=$_POST['xiangximiaoshu1'];
		$lianxidianhua=$_POST['lianxidianhua'];
		$lianxiren=$_POST['lianxiren'];
		$geren_jingjiren=$_POST['geren_jingjiren'];
		if($biaoti==''){
			$result_info = '请输入标题';
		}else if($xiangximiaoshu1==''){
			$result_info = '请给出一些补充说明';
		}else if($lianxidianhua==''){
			$result_info = '请输入联系电话';
		}else if($lianxiren==''){
			$result_info = '请输入联系人';
		}

		
		if(!$result_info){		
			$biaoti = $db->Encode($biaoti);
			$quyu = $db->Encode($quyu);
			$quyu2=$db->Encode($quyu2);
			$zujin_goujia=$db->Encode($zujin_goujia);
			$fangxing=$db->Encode($fangxing);
			$xiangximiaoshu1=$db->Encode($xiangximiaoshu1);
			$lianxidianhua=$db->Encode($lianxidianhua);
			$lianxiren=$db->Encode($lianxiren);
			$geren_jingjiren=$db->Encode($geren_jingjiren);
			
			$sql = "INSERT INTO qiuzu_qiugou 
				(biaoti,quyu,quyu2,zujin_goujia,fangxing,xiangximiaoshu1,lianxidianhua,lianxiren,geren_jingjiren,qiuzu_qiugou,faburen,fabushijian) 
				VALUES ('$biaoti', '$quyu', '$quyu2', '$zujin_goujia', '$fangxing', '$xiangximiaoshu1', '$lianxidianhua', '$lianxiren', '$geren_jingjiren',1,".$_SESSION['user_id'].",NOW())";//默认1为求租
		    $db->Execute($sql);
		    echo "<script>alert('发布成功！');location='geren.php?main=qiuzu_list';</script>";
			$result_info = '发布成功';
		}
	}
	
	$db->Close();
?>
<div class="right_container">
  <div id="MyAnjuke">
    <div class="tab">
      <h1>
        <dl>
          <dt class="tL"></dt>
          <dt class="t0">发布求租信息</dt>
          <dt class="tR"></dt>
        </dl>
      </h1>
    </div>
    <div class="show_post">
      <form id="qiuzu_post" method="post" name="qiuzu_post" style="vertical-align: middle;" action="geren.php?main=qiuzu_post">
        <p style="color:green;padding:5px;font-size:17px;padding-left:122px;">
			<strong><?php echo $result_info;?></strong>
		</p>
		<p> <span class="left_post"><span class="required">*</span>标题:</span>
          <input type="text" maxlength="25" class="text1" value="" id="title" name="title">
        </p>
        <p> <span class="left_post">求租地段:</span>
          <select name="quyu" id="quyu" onchange="getShangQuan()">
            <option value="">--区域--</option>
            <?
				for($ii=0;$ii<count($zufang_quyu_array);$ii++){
					echo "<option value='".$zufang_quyu_array[$ii]['this_id']."'> ".$zufang_quyu_array[$ii]['value']."</option>";
				}
			?>
          </select>
          <span id="quyu2_div">
			  <select name="quyu2" id="quyu2">
				<option value="">--商圈--</option>
			  </select>
		  </span>
        </p>
        <p> <span class="left_post"><span class="required">*</span>租金:</span>
          <select id="zujin_goujia" name="zujin_goujia">
		    <?
				for($ii=0;$ii<count($zufang_zujin_array);$ii++){
					echo "<option value='".$zufang_zujin_array[$ii]['value']."'> ".$zufang_zujin_array[$ii]['C']."</option>";
				}
			?>
          </select>
          元/月
          <select id="fangxing" name="fangxing">
            <option value="">不限居室</option>
			 <?
				for($ii=0;$ii<count($zufang_fangxing_array);$ii++){
					echo "<option value='".$zufang_fangxing_array[$ii]['value']."'> ".$zufang_fangxing_array[$ii]['C']."</option>";
				}
			?>
          </select>
        </p>
		<p> <span class="left_post"><span class="required">*</span>补充说明:</span>
          <textarea name="xiangximiaoshu1" cols="" rows="" style="height: 92px; width: 474px;"></textarea>
        </p>
		<p> <span class="left_post"><span class="required">*</span>手机或电话:</span>
          <input type="text" maxlength="25" class="text1 text2" value="" id="lianxidianhua" name="lianxidianhua">
        </p>
		<p> <span class="left_post"><span class="required">*</span>联系人:</span>
          <input type="text" maxlength="25" class="text1 text2" value="" id="lianxiren" name="lianxiren">
		  <span><input type="checkbox" name="geren_jingjiren" value="经纪人" class="base">&nbsp;我是经纪人</span>
        </p>
		<p>
			<input type="submit" value="马上发布" class="fabu1" id="fabu" name="submit">
		</p>
      </form>
    </div>
  </div>
</div>
